#ifndef __STAR_RECOGNIZER_H__
#define __STAR_RECOGNIZER_H__

#include <tuple>

#include "rkmedia_api.h"
#include <opencv2/imgcodecs/imgcodecs.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;

typedef std::tuple<float /*x1*/, float /*y1*/, float /*x2*/, float /*y2*/> FrameT;

enum recognizerCode {
    RECOGNIZER_OK,
    RECOGNIZER_FIND_NO_SUITABLE_STAR,
    RECOGNIZER_NO_STAR,
    RECOGNIZER_IMAGE_ERROR
};

struct recognizerResultT {
    FrameT maxFrame;
    int maxW;
    float maxHfd;
    int starCount;
    int code;
};

enum recognizerType {
    ORIGINAL_IMAGE,//对原图做识别
    STAR_IMAGE //以第一次识别到的星点为基准，识别此区域的星点
};

recognizerResultT star_recognizer(MEDIA_BUFFER buf, int index, recognizerType type, FrameT frame, const char* path);
int findBrightestStar(Mat& imgSrc, Rect& starMax, const char* path);

#endif